home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 3_7.lha / 3_7 / 3_7detst.c < prev    next >
Text File  |  1993-08-08  |  727b  |  46 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <stream.h>
  6.  
  7. ifdef TSTD
  8. include "3_7d.c"
  9. endif
  10. ifdef TSTE
  11. include "3_7e.c"
  12. endif
  13.  
  14. oid* memcpy(void*, const void*, int);
  15.  
  16. har a[] = "abcdefghijklmnopqrstuvwxyz";
  17. har b[3 * sizeof(a)];
  18.  
  19. har *x[] =
  20.    {
  21.    "",
  22.    "hello there",
  23.    "This is a test",
  24.    "The quick brown fox jumped over the lazy brown dog",
  25.    0
  26.    };
  27.  
  28. ain()
  29.  
  30.    for (char **xp = x; *xp; xp++)
  31.        {
  32. memcpy(b, a, sizeof a);
  33. cout << "str='" << *xp << "'\n";
  34. cout << "b=" << b << "\n";
  35. ifdef TSTD
  36. strcpy(b+3, *xp);
  37. endif
  38. ifdef TSTE
  39. strncpy(b+3, sizeof(a)-3, *xp);
  40. endif
  41. cout << "b=" << b << "\n";
  42. }
  43.  
  44.    return 0;
  45.  
  46.